package com.yhg.xinyi;

import android.app.Application;
import android.content.Context;

import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration;
import com.nostra13.universalimageloader.core.assist.QueueProcessingType;

public class UniteApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();
        initImageLoader(getApplicationContext());   //初始化图片加载框架ImageLoader
    }

    private void initImageLoader(Context context) {
        ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(context)
                .threadPriority(Thread.MAX_PRIORITY).denyCacheImageMultipleSizesInMemory()//线程优先级
                .diskCacheFileNameGenerator(new Md5FileNameGenerator())//是否使用缓存是否使用磁盘存储
                .tasksProcessingOrder(QueueProcessingType.LIFO)//排序方式_最近常用
                .writeDebugLogs()//
                .build();
        ImageLoader.getInstance().init(configuration);
    }
}
